<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Article extends Model
{
    /**
     * 获取关联文章类型
     */
    public function type()
    {
        return $this->hasOne('App\ArticleType');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function comments()
    {
        return $this->hasMany(Comment::class, 'a_id', 'id');
    }
}
